package org.spring.demo.action;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.spring.demo.service.Config;
import org.spring.demo.service.DemoService;
import org.spring.mvcframework.annotation.GPAutowired;
import org.spring.mvcframework.annotation.GPController;
import org.spring.mvcframework.annotation.GPRequestMapping;
import org.spring.mvcframework.annotation.GPRequestParam;

@GPController
@GPRequestMapping("/demo")
public class DemoAction {

	@GPAutowired
	private DemoService service;
	
	@GPAutowired
	private Config config;

	@GPRequestMapping("/query.json")
	public void query(HttpServletRequest req, HttpServletResponse resp, @GPRequestParam(value="names",required=true) String namebbb) {
		String result = service.getName(namebbb);
		try {
			System.out.println("name is"+config.getName());
			resp.getWriter().write(result+",config is:"+config.getName());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
